package com.wyy.controller;

import com.wyy.pojo.Comments;
import com.wyy.pojo.model.CommentQuery;
import com.wyy.response.CommonReturnType;
import com.wyy.web.CommentFeignAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: gytcb
 * @author: 吴磊
 * @create: 2021-06-05 13:09
 */
@RestController
public class CommentController {
    @Autowired
    private CommentFeignAction commentFeignAction;

    /**
     * 用户进行评论
     *
     * @param comments
     * @return
     */
    @RequestMapping(value = "/insertComment", method = RequestMethod.POST)
    public CommonReturnType tokenInsertComment(@RequestBody Comments comments) {
        return commentFeignAction.tokenInsertComment(comments);
    }

    /**
     * 用户删除评论
     *
     * @param comments
     * @return
     */
    @RequestMapping(value = "/deleteComment", method = RequestMethod.POST)
    public CommonReturnType tokenDeleteComment(@RequestBody Comments comments) {
        return commentFeignAction.tokenDeleteComment(comments);
    }

    /**
     * 获取评论
     *
     * @param commentQuery
     * @return
     */
    @RequestMapping(value = "/getCommentBySomething", method = RequestMethod.POST)
    public CommonReturnType getCommentByArticleIdOrUserId(@RequestBody CommentQuery commentQuery) {
        return commentFeignAction.getCommentByArticleIdOrUserId(commentQuery);
    }
}
